package com.clementheliou.cheliou.dal.model.member.fest.asserter;

import static org.fest.assertions.api.Assertions.assertThat;

import org.fest.assertions.api.AbstractAssert;

import com.clementheliou.cheliou.dal.core.fest.assertions.CHeliouDALAssertions;
import com.clementheliou.cheliou.dal.model.member.Member;

/**
 * FEST asserter used to make test code about {@link Member} instances more readable. It should only
 * be used through the static factory that can be found into the project assertions class (
 * {@link CHeliouDALAssertions}).
 * 
 * @author Clément HELIOU (clement.heliou@gmail.com)
 * @see {@link AbstractAssert};
 * @see {@link CHeliouDALAssertions};
 * @see {@link Member}.
 * @since 1.0
 */
public class MemberAsserter extends AbstractAssert<MemberAsserter, Member> {

	/**
	 * Constructor from the {@link Member} to be asserted.
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @param actual the {@link Member} instance to be asserted.
	 * @since 1.0
	 */
	public MemberAsserter(final Member actual) {
		super(actual, MemberAsserter.class);
	}

	/**
	 * Asserts that current {@link Member} has the expected email.
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @param expectedEmail the expected email value.
	 * @return the asserter instance after this assertion.
	 * @since 1.0
	 */
	public MemberAsserter hasEmail(final String expectedEmail) {
		isNotNull();
		assertThat(actual.getEmail()).isEqualTo(expectedEmail);
		return this;
	}
}
